﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace JVLMRP
{
    public class SessionFactory
    {

        public static NHibernate.ISessionFactory _SessionFactory;
        private static void Init()
        {
            NHibernate.Cfg.Configuration config;
            config = new NHibernate.Cfg.Configuration();
            config.Configure();

            config.AddAssembly("JVLMRP");
            _SessionFactory = config.BuildSessionFactory();
        }
        public static NHibernate.ISessionFactory GetSessionFactory()
        {

            if (_SessionFactory == null)
            {
                Init();
            }
            return _SessionFactory;
        }
        public static NHibernate.ISession GetNewSession()
        {
            return GetSessionFactory().OpenSession();
        }

    }
}